<%@page import="com.google.appengine.api.datastore.Entity"%>
<%@page import="java.util.Iterator"%>
<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>datastore ex1 Read</title>
</head>
<body>
<%
	Iterator<Entity> list = (Iterator<Entity>) request.getAttribute("entities");

	String userId = "";
	String name = "";
	String age = "";
	String msg = "";

	if (list.hasNext()) {
		Entity en = list.next();

		userId = (String) en.getProperty("userId");
		name = (String) en.getProperty("name");
		age = (String) en.getProperty("age");
	} else {
		msg = "データが存在しません";
	}



%>

<table>
	<tr>
		<td>ＩＤ：</td><td><%= userId %></td>
	</tr>
	<tr>
		<td>氏名：</td><td><%= name %></td>
	</tr>
	<tr>
		<td>年齢：</td><td><%= age %></td>
	</tr>
</table>
<p><%= msg %></p>
<br/>
<a href="/datastore/ex1/create">Taroを登録します</a>
<br/>
<a href="/datastore/ex1/delete">Taroを削除します</a>
<br/>
<a href="/datastore/ex1/update">Taroの年齢を更新します</a>
</body>
</html>
